package com.javacoo.limit.client.handler;

import org.springframework.aop.Pointcut;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor;
import org.springframework.beans.factory.annotation.Autowired;

import com.javacoo.limit.client.config.LimitConfig;

import lombok.extern.slf4j.Slf4j;

/**
 * 限流切面Advisor
 * <li></li>
 *
 * @author: duanyong@jccfc.com
 * @since: 2021/5/23 10:52
 */
@Slf4j
public class LimitPointcutAdvisor extends AbstractBeanFactoryPointcutAdvisor {
    @Autowired
    private LimitConfig lockConfig;
    @Override
    public Pointcut getPointcut() {
        AspectJExpressionPointcut adapterPointcut = new AspectJExpressionPointcut();
        //从配置文件中获取PointCut表达式
        adapterPointcut.setExpression(lockConfig.getExpression());
        return adapterPointcut;
    }
}
